<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class A_sy extends CI_Controller {

	function __construct() {
        parent::__construct();	
		$this->load->model("master/master_th_ajaran"); 
		$this->load->model("atur/atur_syahriyah"); 
	}
	
	function index()
	{
		$data['judul'] = "Pengaturan Tagihan Syahriyah";
		$data['list'] = $this->master_th_ajaran->read();
		$data['main_view']='atur/syahriyah/th_ajaran';
		$this->load->view('index',$data);
		
	}
	
	function jenjang($id_m_th_ajaran)
	{
		$data['judul'] = "Pengaturan Tagihan Syahriyah";
		$data['list']=$this->atur_syahriyah->jenjang($id_m_th_ajaran);				
		$data['list_th']=$this->master_th_ajaran->detail($id_m_th_ajaran);			
		$data['list_jp']=$this->atur_syahriyah->jp_th_ajar($id_m_th_ajaran);	
		
		$data['main_view']='atur/syahriyah/jenjang';
		$this->load->view('index',$data);
	}

	function add()
	{
		$id_m_th_ajaran = $this->input->post('id_m_th_ajaran');
		$data['list_th']=$this->master_th_ajaran->detail($id_m_th_ajaran);
		$data['list_jp']=$this->atur_syahriyah->jp_th_ajar($id_m_th_ajaran);
		$this->load->view('atur/syahriyah/add',$data);
	}
	
	function save()
	{
		$dataInsert = array(
			'id_m_th_ajaran' => $this->input->post('id_m_th_ajaran'),
			'id_m_j_pendidikan' => $this->input->post('id_m_j_pendidikan'),
			'besar_sy' => $this->input->post('besar_sy')
		);
		$this->atur_syahriyah->save($dataInsert);
	}	
	
	function delete()
	{
		$id_a_sy = $this->input->post('id_a_sy');
		$this->atur_syahriyah->delete($id_a_sy);
	}
	
	function refresh()
	{
		$id_m_th_ajaran = $this->security->xss_clean($this->uri->segment(3));
		$data['list']=$this->atur_syahriyah->jenjang($id_m_th_ajaran);
		$data['list_th']=$this->master_th_ajaran->detail($id_m_th_ajaran);	
		$this->load->view('atur/syahriyah/refresh', $data);		
	}
}